task exportConfigMetadata(group: "CAS", description: "Export collection of CAS properties") {
    doLast {
        def file = new File(project.rootDir, 'config-metadata.properties')
        file.withWriter('utf-8') { writer ->
            def repository = new CasConfigurationMetadataRepository()
            def props = repository.query(ConfigurationMetadataCatalogQuery.builder()
                .casExclusive(true)
                .build())
                .properties()
            props.each { property ->
                writer.writeLine("# Type: ${property.type}");
                writer.writeLine("# Module: ${property.module}")
                writer.writeLine("# Owner: ${property.owner}")
                if (property.deprecationLevel != null) {
                    writer.writeLine("# This setting is deprecated with a severity level of ${property.deprecationLevel}.")
                    if (property.deprecationReason != null) {
                        writer.writeLine("# because ${property.deprecationReason}")
                    }
                    if (property.deprecationReason != null) {
                        writer.writeLine("# Replace with: ${property.deprecationReason}")
                    }
                }
                writer.writeLine("# ${property.description}");
                writer.writeLine("# ${property.name}: ${property.defaultValue}")
                writer.writeLine("")
            }
        }
        println "Configuration metadata is available at ${file.absolutePath}"
    }
}